<?php ini_set("memory_limit","32M"); ?>
<link href="<?=base_url()?>asset/admin/css/style.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
	function report_pdf(){		      
            var site = "<?php echo site_url()?>";
           /* $.ajax({
                url: site+"/laporan_pembelian/index",
                success: function(response){			
                $("#tab").html(response);
                },
            dataType:"html"  		
            });
            return false;*/
			var periode_awal=document.getElementById('tanggal_awal').value;
			var periode_akhir=document.getElementById('tanggal_akhir').value;
			  location.href = site+"/laporan_buku_kas/report_pdf/"+periode_awal+'/'+periode_akhir;
	}
	
	function report_excel(){
		document.getElementById("rekap_tabel1").value = document.getElementById("div_laporan").innerHTML;
		document.getElementById("myform").submit();
	}
	
	
	function print(){
		/*<form>
		<input type="button" value="Print This Page" onClick="window.print()" />
		</form>*/
	}
	
	
</script>
			<div id="tab-settings" class="tabs-content">
					<button type="button" onclick="report_pdf()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP PDF</button>
					<button type="submit" onclick="report_excel()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP EXCEL</button>
					
			</div>	
<?php
	$attributes = array('class' => 'formccs', 'id' => 'myform', 'name'=> 'myform');	
	echo form_open('laporan_buku_kas/report_excel', $attributes);
?>	
<div id="div_laporan">
	<input name="rekap_tabel1" id="rekap_tabel1" type="hidden" value="rekap_tabel1" />
	<input name="periode_awal" id="tanggal_awal" type="hidden" value="<?=$periode_awal;?>" />
	<input name="periode_akhir" id="tanggal_akhir" type="hidden" value="<?=$periode_akhir;?>" />
	
	<table class="laporan" width="90%" border="1">
		<tr><td colspan="5"  div align="center"><b>KEMENTRIAN KOMUNIKASI DAN INFORMATIKA</b></td></tr>		<tr><td colspan="5"  div align="center"><b>DIREKTORAT JENDERAL PENYELENGGARAAN POS DAN INFORMATIKA</b></td></tr>
		
		<tr><td colspan="5" div align="center"><b>BALAI PENYEDIA DAN PENGELOLA PEMBIAYAAN TELEKOMUNIKASI DAN INFORMATIKA</b><br/></td></tr>
		<tr><td colspan="5" div align="center"><b>TRIAL BALANCE</b></td></tr>
		<tr><td colspan="5" div align="center"><b>Per : <?php echo $this->fungsi->dateindo3('-',$periode_awal) . ' S/D ' .  $this->fungsi->dateindo3('-',$periode_akhir); ?></b></td></tr>		<tr><td colspan="5" div align="center">(Dalam Rupiah)</td></tr>						
		<!--<tr><td colspan="10"><b>TANGGAL CETAK : <?php /* echo $this->fungsi->dateindo3('-',date('Y-m-d')) */ ?></b></td></tr>-->				<table id="kolom">
					<tr>						<tr>							<th colspan="3" scope="col">AKUN SALDO</th>						</tr>						<tr>
							<th scope="col">AKUN</th>
							<th scope="col">DEBET</th>
							<th scope="col">KREDIT</th>						</tr>						
					</tr>						<?						$j=1;						foreach($results_kas->result() as $row)						{												?>							<tr>								<td align="left" valign="middle">									<?php 										/*										if ($row->AKUNID[1]==0){											echo $row->NAKUN;										}else if($row->AKUNID[2]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[3]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[4]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else{											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}										*/																				echo $row->AKUNID . '-' . $row->NAKUN;																		?>								</td>								<td align="right" valign="middle">									<?php										$awal_debet = $row->DEBET;										if ($awal_debet<0) {											echo  "(" . abs($awal_debet) . ")";										}else											echo $awal_debet;									?>								</td>								<td align="right" valign="middle">									<?php										$awal_kredit = $row->KREDIT;										if ($awal_kredit<0) {											echo  "(" . abs($awal_kredit) . ")";										}else											echo $awal_kredit;									?>								</td>																						</tr>					<?php								$sum_debet_awal[] = $row->DEBET;								$sum_kredit_awal[] = $row->KREDIT;					}					?>						<tr>							<td>Jumlah</td>							<td><?=array_sum($sum_debet_awal);?></td>							<td><?=array_sum($sum_kredit_awal);?></td>						</tr>										</table>				<table id="kolom">					<tr>						<tr>							<th colspan="3" scope="col">MUTASI</th>						</tr>						<tr>							<th scope="col">AKUN</th>							<th scope="col">DEBET</th>							<th scope="col">KREDIT</th>						</tr>											</tr>						<?						$j=1;						foreach($results_mutasi_kas->result() as $row)						{												?>							<tr>								<td align="left" valign="middle">									<?php 										/*										if ($row->AKUNID[1]==0){											echo $row->NAKUN;										}else if($row->AKUNID[2]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[3]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[4]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else{											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}										*/																				echo $row->AKUNID . '-' . $row->NAKUN;									?>								</td>								<td align="right" valign="middle">									<?php										$awal_debet = $row->DEBET;										if ($awal_debet<0) {											echo  "(" . abs($awal_debet) . ")";										}else											echo $awal_debet;									?>								</td>								<td align="right" valign="middle">									<?php										$awal_kredit = $row->KREDIT;										if ($awal_kredit<0) {											echo  "(" . abs($awal_kredit) . ")";										}else											echo $awal_kredit;																															?>								</td>																						</tr>					<?php								$sum_debet_mutasi[] = $row->DEBET;								$sum_kredit_mutasi[] = $row->KREDIT;						}					?>						<tr>							<td>Jumlah</td> 							<td><?=array_sum($sum_debet_mutasi);?></td>							<td><?=array_sum($sum_kredit_mutasi);?></td>							 						</tr>				</table>				<table id="kolom">					<tr>						<tr>							<th colspan="3" scope="col">SALDO AKHIR</th>						</tr>						<tr>							<th scope="col">AKUN</th>							<th scope="col">DEBET</th>							<th scope="col">KREDIT</th>						</tr>											</tr>						<?						$j=1;						foreach($results_kas->result() as $row)						{												?>							<tr>								<td align="left" valign="middle">									<?php 										/*										if ($row->AKUNID[1]==0){											echo $row->NAKUN;										}else if($row->AKUNID[2]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[3]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else if($row->AKUNID[4]==0){											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}else{											echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 											&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . $row->NAKUN;										}*/									echo $row->AKUNID . '-' . $row->NAKUN;									?>								</td>								<td align="right" valign="middle">									<?php										$awal_debet = $row->DEBET;										if ($awal_debet<0) {											echo  "(" . abs($awal_debet) . ")";										}else										{											echo $awal_debet;											}									?>								</td>								<td align="right" valign="middle">									<?php										$awal_kredit = $row->KREDIT;										if ($awal_kredit<0) {											echo  "(" . abs($awal_kredit) . ")";																					}else										{											echo $awal_kredit;											echo 'warning';											}									?>								</td>																						</tr>					<?php								$sum_debet_akhir[] = $row->DEBET;								$sum_kredit_akhir[] = $row->KREDIT;														}					?>						<tr>							<td>Jumlah</td>							<td><?=array_sum($sum_debet_akhir);?></td>							<td><?=array_sum($sum_kredit_akhir);?></td>						</tr>				</table>
	</table>
</div>
</form>